package com.dxg.provider.service;

import cn.hutool.core.collection.CollectionUtil;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * @author dingxigui
 * @version 1.0
 * @date 2021/7/30 16:26
 */
@Component
public class SmsUserDetailService implements UserDetailsService {

  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    //伪造数据
    User user = new User("smsdingding", "sms123", CollectionUtil.newArrayList(new SimpleGrantedAuthority("q1")));
    return user;
  }
}
